package com.bnlr.lrparking.adapter;

import android.content.Intent;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.bnlr.lrparking.R;
import com.bnlr.lrparking.appui.stall.DevelopersMaterialActivity;
import com.bnlr.lrparking.model.SelectDevelopersM;

import java.util.List;

/**
 * Created by tian on 2017/9/16.
 */

public class SelectDevelopersAdapter extends BaseQuickAdapter<SelectDevelopersM.DataBean,BaseViewHolder>{
    public SelectDevelopersAdapter(@Nullable List<SelectDevelopersM.DataBean> data) {
        super(R.layout.item_selectdevelopers,data);
    }

    @Override
    protected void convert(BaseViewHolder holder, final SelectDevelopersM.DataBean item) {
        holder.setIsRecyclable(false);
        ImageView iv = holder.getView(R.id.img_selectdevelopers);//图片
        Glide.with(mContext)
                .load(item.getPhotoUrl())
                .placeholder(R.mipmap.tab2_defaultgraph).error(R.mipmap.tab2_defaultgraph)
                .into(iv);
        holder.setText(R.id.tv_title_selectdevelopers,item.getName());//楼盘名称
        holder.setText(R.id.tv_selectdevelopers1,"全部"+item.getParkSpace());//全部
        holder.setText(R.id.tv_selectdevelopers2,"已售"+item.getSoldCount());//已售
        holder.setText(R.id.plot_name,item.getAddress());//开发商名称
        ImageView ivClick = holder.getView(R.id.img_click_selectdevelopers);//图片
        ivClick.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(mContext,DevelopersMaterialActivity.class);
                intent.putExtra("developId",item.getDevelopId()+"");
                mContext.startActivity(intent);
            }
        });
    }
}
